/**
 * Copyright 2002 Cordys R&D B.V. 
 * 
 * This file is part of the Cordys .NET Connector. 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#if !defined(AFX_MANAGEDCALLHANDLER_H__INCLUDED_)
#define AFX_MANAGEDCALLHANDLER_H__INCLUDED_

//@Author	: Lejil 
//@Class	: ManagedCallHandler
//
//		This will call .NET Method ,using  Reflection
//	  prepares the response ,from the method result

#pragma once
#include "Parameters.h"

using namespace	System::Reflection;
using namespace System::Xml;
using namespace System::IO;

__gc class ManagedCallHandler 
		{

		public :
				
			    ManagedCallHandler(Parameters *params)
				{
					parameters			= params;
				}
				~ManagedCallHandler()
				{
					
				}
				
			  /**
			   * Call .NET Methods based on Type
			   *	ie. Static, MetaData  or Instance 	
			   *		 and then prepare the response back
			   */
				bool Invoke(int response);
				
				
				void LoadClass();
			
				

		private :
			/**
			 *	
			 *
			 */
			  Type *classType ;
			/**	
			  *	This hold , all the data which are required for
			  *           calling the .NET Method
			  */
			  Parameters __gc  *parameters;
			 /**
			  *  Create the Response Node,After calling the Required methods
			  *	
			  */	
			  bool CreateResponse(Object *result,int response);
			 /**
			  *	Call the .NET Instance method and prepare the response back
			  *
			  */
		      bool InvokeInstanceMethod(int response);  
			  /**
			  * Call the Static .NET Method and prepare the response back
			  *	
			  */
			  bool InvokeStaticMethod(int response);
			 /**
			  * Call the MetaData Method and prepare the response back
			  *	
			  */
			  bool InvokeMetaData(int response);

			
		        
		};

#endif 